package com.cimu.mybatisplus2.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.cimu.mybatisplus2.entity.User;
import com.cimu.mybatisplus2.mapper.UserMapper;
import com.cimu.mybatisplus2.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.Banner;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * Title: UserServiceImpl
 * Copyright: Copyright (c) 2017
 *
 *
 *
 * date 2018年11月23日 18:28
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    public User getById(Long id) {
        return baseMapper.selectById(id);
    }

    @Override
    public List<User> selectAll(String realName) {
        return new User().selectList(
                new EntityWrapper<User>().eq(!StringUtils.isEmpty(realName),"real_name",realName));
    }

    @Override
    public int deleteAll() {
        return baseMapper.deleteAll();
    }

}
